package com.yida.gwj.expend.outside.service.impl;

import java.time.LocalDateTime;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yida.common.security.utils.SecurityUtils;
import com.yida.gwj.expend.outside.domain.GwjMaintenanceFundsBusinessLog;
import com.yida.gwj.expend.outside.mapper.GwjMaintenanceFundsBusinessLogMapper;
import com.yida.gwj.expend.outside.service.IGwjMaintenanceFundsBusinessLogService;

import cn.hutool.core.util.ObjectUtil;

/**
 * 签署意见Service业务层处理
 *
 * @author lgp
 * @date 2023-02-20
 */
@Service
public class GwjMaintenanceFundsBusinessLogServiceImpl implements IGwjMaintenanceFundsBusinessLogService {
    @Autowired
    private GwjMaintenanceFundsBusinessLogMapper gwjMaintenanceFundsBusinessLogMapper;

    /**
     * 查询签署意见
     *
     * @param businessLogId 签署意见主键
     * @return 签署意见
     */
    @Override
    public GwjMaintenanceFundsBusinessLog selectGwjMaintenanceFundsBusinessLogByBusinessLogId(Long businessLogId) {
        return gwjMaintenanceFundsBusinessLogMapper.selectGwjMaintenanceFundsBusinessLogByBusinessLogId(businessLogId);
    }

    /**
     * 查询签署意见列表
     *
     * @param gwjMaintenanceFundsBusinessLog 签署意见
     * @return 签署意见
     */
    @Override
    public List<GwjMaintenanceFundsBusinessLog> selectGwjMaintenanceFundsBusinessLogList(GwjMaintenanceFundsBusinessLog gwjMaintenanceFundsBusinessLog) {
        return gwjMaintenanceFundsBusinessLogMapper.selectGwjMaintenanceFundsBusinessLogList(gwjMaintenanceFundsBusinessLog);
    }

    /**
     * 新增签署意见
     *
     * @param gwjMaintenanceFundsBusinessLog 签署意见
     * @return 结果
     */
    @Override
    public int insertGwjMaintenanceFundsBusinessLog(GwjMaintenanceFundsBusinessLog gwjMaintenanceFundsBusinessLog) {
        gwjMaintenanceFundsBusinessLog.setAcceptTime(LocalDateTime.now());
        if (ObjectUtil.isNull(gwjMaintenanceFundsBusinessLog.getOperId())) {
            gwjMaintenanceFundsBusinessLog.setOperId(SecurityUtils.getLoginUser().getUserid());
            gwjMaintenanceFundsBusinessLog.setOperName(SecurityUtils.getLoginUser().getSysOutsideUser().getRealName());
        }
        return gwjMaintenanceFundsBusinessLogMapper.insertGwjMaintenanceFundsBusinessLog(gwjMaintenanceFundsBusinessLog);
    }

    /**
     * 修改签署意见
     *
     * @param gwjMaintenanceFundsBusinessLog 签署意见
     * @return 结果
     */
    @Override
    public int updateGwjMaintenanceFundsBusinessLog(GwjMaintenanceFundsBusinessLog gwjMaintenanceFundsBusinessLog) {
        return gwjMaintenanceFundsBusinessLogMapper.updateGwjMaintenanceFundsBusinessLog(gwjMaintenanceFundsBusinessLog);
    }

    /**
     * 批量删除签署意见
     *
     * @param businessLogIds 需要删除的签署意见主键
     * @return 结果
     */
    @Override
    public int deleteGwjMaintenanceFundsBusinessLogByBusinessLogIds(Long[] businessLogIds) {
        return gwjMaintenanceFundsBusinessLogMapper.deleteGwjMaintenanceFundsBusinessLogByBusinessLogIds(businessLogIds);
    }

    /**
     * 删除签署意见信息
     *
     * @param businessLogId 签署意见主键
     * @return 结果
     */
    @Override
    public int deleteGwjMaintenanceFundsBusinessLogByBusinessLogId(Long businessLogId) {
        return gwjMaintenanceFundsBusinessLogMapper.deleteGwjMaintenanceFundsBusinessLogByBusinessLogId(businessLogId);
    }

    /**
     * 通过businessId修改签署意见
     *
     * @param gwjMaintenanceFundsBusinessLog 签署意见
     * @return 结果
     */
    @Override
    public int updateGwjMaintenanceFundsBusinessLogByBusinessId(GwjMaintenanceFundsBusinessLog gwjMaintenanceFundsBusinessLog) {
        return gwjMaintenanceFundsBusinessLogMapper.updateGwjMaintenanceFundsBusinessLogByBusinessId(gwjMaintenanceFundsBusinessLog);
    }

}
